| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Public Member Functions | Static Public Member Functions | List of all members
nkGraphics::Camera Class Reference

Offers all controls to model a camera. More...

Inheritance diagram for nkGraphics::Camera:

## Public Member Functions
const Frustum & | getFrustum ()
nkMemory::StringView | getName () const
PROJECTION_TYPE | getProjectionType () const
float | getPerspectiveFov () const
float | getPerspectiveAspectRatio () const
float | getPerspectiveOffCenterFovLeft () const
float | getPerspectiveOffCenterFovRight () const
float | getPerspectiveOffCenterFovTop () const
float | getPerspectiveOffCenterFovBottom () const
float | getOrthographicHeight () const
float | getOrthographicAspectRatio () const
float | getNear () const
float | getFar () const
bool | getAutoUpdateOnContextSwitch () const
bool | getHidden () const
bool | getReverseZ () const
bool | getInfiniteZ () const
const nkMaths::Matrix & | getViewMatrix () const
const nkMaths::Matrix & | getProjectionMatrix () const
nkMaths::Matrix | getViewProjMatrix () const
nkMaths::Vector | getProjectionParameters () const
virtual void | setPositionRelative (const nkMaths::Vector &value) override
virtual void | setPositionAbsolute (const nkMaths::Vector &value) override
virtual void | translateRelative (const nkMaths::Vector &value) override
virtual void | translateAbsolute (const nkMaths::Vector &value) override
virtual void | setOrientationRelative (const nkMaths::Quaternion &value) override
virtual void | setOrientationAbsolute (const nkMaths::Quaternion &value) override
virtual void | rotateRelative (const nkMaths::Quaternion &value) override
virtual void | rotateAbsolute (const nkMaths::Quaternion &value) override
virtual void | setScaleRelative (const nkMaths::Vector &value) override
virtual void | setScaleAbsolute (const nkMaths::Vector &value) override
virtual void | applyScale (const nkMaths::Vector &value) override
void | setName (nkMemory::StringView name)
void | setAsPerspective (float fovRadian, float aspectRatioWidthOverHeight)
void | setAsPerspectiveReverseZ (float fovRadian, float aspectRatioWidthOverHeight)
void | setAsPerspectiveReverseInfiniteZ (float fovRadian, float aspectRatioWidthOverHeight)
void | setAsPerspectiveOffCenter (float fovLeftRadian, float fovRightRadian, float fovTopRadian, float fovBottomRadian)
void | setAsPerspectiveOffCenterReverseZ (float fovLeftRadian, float fovRightRadian, float fovTopRadian, float fovBottomRadian)
void | setAsPerspectiveOffCenterReverseInfiniteZ (float fovLeftRadian, float fovRightRadian, float fovTopRadian, float fovBottomRadian)
void | setAsOrthographic (float height, float aspectRatioWidthOverHeight)
void | setAsOrthographicReverseZ (float height, float aspectRatioWidthOverHeight)
void | setRange (float near, float far)
void | prepareForContext (RenderContext *context)
void | setAutoUpdateOnContextSwitch (bool value)
void | setHidden (bool value)
void | updateViewMatrix ()
void | updateProjectionMatrix ()
void | lookAt (const nkMaths::Vector &point, const nkMaths::Vector &enforcedUp=nkMaths::Vector(0, 0, 0, 0))
void | getNearPlanePoints (nkMaths::Vector &a, nkMaths::Vector &b, nkMaths::Vector &c, nkMaths::Vector &d)
void | getFarPlanePoints (nkMaths::Vector &a, nkMaths::Vector &b, nkMaths::Vector &c, nkMaths::Vector &d)
void | getFrustumCornersDirectionsWorld (nkMaths::Vector &a, nkMaths::Vector &b, nkMaths::Vector &c, nkMaths::Vector &d)
void | getFrustumCornersDirectionsView (nkMaths::Vector &a, nkMaths::Vector &b, nkMaths::Vector &c, nkMaths::Vector &d)
nkMaths::Vector | getDirectionAtPixelWorld (int x, int y, RenderContext *fromContext=nullptr)
nkMaths::Vector | getDirectionAtScreenCoordWorld (float x, float y)
nkMaths::Vector | getDirectionAtPixelView (int x, int y, RenderContext *fromContext=nullptr)
nkMaths::Vector | getDirectionAtScreenCoordView (float x, float y)
virtual void | exportClassToTree (nkExport::Node *rootNode) override
virtual void | importClassFromTree (nkExport::Node *rootNode) override
Public Member Functions inherited from nkGraphics::Node
virtual | ~Node ()
nkMaths::Vector | getPositionRelative () const
nkMaths::Vector | getPositionAbsolute ()
nkMaths::Quaternion | getOrientationRelative () const
nkMaths::Quaternion | getOrientationAbsolute ()
nkMaths::Vector | getScaleRelative () const
nkMaths::Vector | getScaleAbsolute ()
void | setRelativeTransform (const nkMaths::Matrix &value)
void | setAbsoluteTransform (const nkMaths::Matrix &value)
nkMaths::Matrix | getRelativeTransform ()
nkMaths::Matrix | getAbsoluteTransform ()
void | updateTransformations ()
void | dispatchDirtyTransform ()
bool | getTransformDirty () const
nkMaths::Vector | getAbsoluteUp ()
nkMaths::Vector | getAbsoluteFront ()
nkMaths::Vector | getAbsoluteRight ()
void | setParentNode (Node *parent)
Node * | getParentNode () const
Node * | getChildNode (unsigned int index) const
unsigned int | getNumChildNode () const
void | setName (nkMemory::StringView value)
nkMemory::StringView | getName () const
bool | getHidden () const
void | setHidden (bool value)
void | addEntityToTrack (Entity *entity)
void | stopEntityTracking (Entity *entity)
unsigned int | getTrackedEntityCount () const
Entity * | getTrackedEntity (unsigned int index) const
void | registerListener (NodeChangeListener *listener)
void | unregisterListener (NodeChangeListener *listener)
Public Member Functions inherited from nkExport::Exportable
| Exportable () noexcept
virtual | ~Exportable ()

## Static Public Member Functions
static nkMemory::UniquePtr< Camera > | create (System *system=nullptr)
Static Public Member Functions inherited from nkGraphics::Node
static nkMemory::UniquePtr< Node > | create (System *system=nullptr)

## Detailed Description

Offers all controls to model a camera.

See CameraManager::createOrRetrieve() or Camera::create() for instantiation.

## Member Function Documentation

## ◆ getFrustum()

const Frustum& nkGraphics::Camera::getFrustum | ( |  | ) |

Returns
  The frustum representing the field of view of the camera.

## ◆ getName()

nkMemory::StringView nkGraphics::Camera::getName | ( |  | ) | const

Returns
  The camera's name.

## ◆ getProjectionType()

PROJECTION_TYPE nkGraphics::Camera::getProjectionType | ( |  | ) | const

Returns
  The projection type currently used by the camera.

## ◆ getPerspectiveFov()

float nkGraphics::Camera::getPerspectiveFov | ( |  | ) | const

Returns
  The vertical field of view of the camera, in radians, for a perspective projection type.

## ◆ getPerspectiveAspectRatio()

float nkGraphics::Camera::getPerspectiveAspectRatio | ( |  | ) | const

Returns
  The currently used aspect ratio (width / height), for a perspective projection type.

## ◆ getPerspectiveOffCenterFovLeft()

float nkGraphics::Camera::getPerspectiveOffCenterFovLeft | ( |  | ) | const

Returns
  The horizontal left field of view of the camera, in radians, for a perspective off-center projection type.

## ◆ getPerspectiveOffCenterFovRight()

float nkGraphics::Camera::getPerspectiveOffCenterFovRight | ( |  | ) | const

Returns
  The horizontal right field of view of the camera, in radians, for a perspective off-center projection type.

## ◆ getPerspectiveOffCenterFovTop()

float nkGraphics::Camera::getPerspectiveOffCenterFovTop | ( |  | ) | const

Returns
  The vertical top field of view of the camera, in radians, for a perspective off-center projection type.

## ◆ getPerspectiveOffCenterFovBottom()

float nkGraphics::Camera::getPerspectiveOffCenterFovBottom | ( |  | ) | const

Returns
  The vertical bottom field of view of the camera, in radians, for a perspective off-center projection type.

## ◆ getOrthographicHeight()

float nkGraphics::Camera::getOrthographicHeight | ( |  | ) | const

Returns
  The orthographic height used by the camera, in world units.

## ◆ getOrthographicAspectRatio()

float nkGraphics::Camera::getOrthographicAspectRatio | ( |  | ) | const

Returns
  The currently used aspect ratio (width / height), for an orthographic projection type.

## ◆ getNear()

float nkGraphics::Camera::getNear | ( |  | ) | const

Returns
  Current near plane distance used.

## ◆ getFar()

float nkGraphics::Camera::getFar | ( |  | ) | const

Returns
  Current far plance distance used.

## ◆ getAutoUpdateOnContextSwitch()

bool nkGraphics::Camera::getAutoUpdateOnContextSwitch | ( |  | ) | const

Returns
  Whether the camera will auto update its aspect ratio before being used in a context (true) or not (false).

## ◆ getHidden()

bool nkGraphics::Camera::getHidden | ( |  | ) | const

Returns
  Whether the camera is hidden from project saving (true) or not (false).

## ◆ getReverseZ()

bool nkGraphics::Camera::getReverseZ | ( |  | ) | const

Returns
  Whether the camera is currently using a reversed Z projection (true) or not (false).

## ◆ getInfiniteZ()

bool nkGraphics::Camera::getInfiniteZ | ( |  | ) | const

Returns
  Whether the camera is currently using an infinite Z projection (true) or not (false).

## ◆ getViewMatrix()

const nkMaths::Matrix& nkGraphics::Camera::getViewMatrix | ( |  | ) | const

Returns
  The current view matrix.

## ◆ getProjectionMatrix()

const nkMaths::Matrix& nkGraphics::Camera::getProjectionMatrix | ( |  | ) | const

Returns
  The current projection matrix.

## ◆ getViewProjMatrix()

nkMaths::Matrix nkGraphics::Camera::getViewProjMatrix | ( |  | ) | const

Returns
  The view * proj matrix.

## ◆ getProjectionParameters()

nkMaths::Vector nkGraphics::Camera::getProjectionParameters | ( |  | ) | const

Allows to retrieve the projection parameters of the camera. These parameters allow to reconstruct the linear ([0, 1]) depth from the camera, of a projected position.
To recompose the depth, these formulas can be used both within CPU or GPU shader code :

Projection type | Formula
--- | ---
Perspective | B / (z - A)
Orthographic | near + z * far

Returns
  The vector filled with the parameters, (A, B, near, far).

Remarks
  The projected depth is expected to be within [0, 1] in both DirectX and OpenGL. While the GPU will naturally sample in this interval from a depth buffer, if the reconstruction happens in another context with OpenGL, the projected Z needs to be corrected from [-1, 1] to [0, 1]. This can be done with (z * 0.5 + 0.5).

## ◆ setPositionRelative()

virtual void nkGraphics::Camera::setPositionRelative | ( | const nkMaths::Vector & | value | ) |
| override virtual

See Node::setPositionRelative().

Reimplemented from nkGraphics::Node.

## ◆ setPositionAbsolute()

virtual void nkGraphics::Camera::setPositionAbsolute | ( | const nkMaths::Vector & | value | ) |
| override virtual

See Node::setPositionAbsolute().

Reimplemented from nkGraphics::Node.

## ◆ translateRelative()

virtual void nkGraphics::Camera::translateRelative | ( | const nkMaths::Vector & | value | ) |
| override virtual

See Node::translateRelative().

Reimplemented from nkGraphics::Node.

## ◆ translateAbsolute()

virtual void nkGraphics::Camera::translateAbsolute | ( | const nkMaths::Vector & | value | ) |
| override virtual

See Node::translateAbsolute().

Reimplemented from nkGraphics::Node.

## ◆ setOrientationRelative()

virtual void nkGraphics::Camera::setOrientationRelative | ( | const nkMaths::Quaternion & | value | ) |
| override virtual

See Node::setOrientationRelative().

Reimplemented from nkGraphics::Node.

## ◆ setOrientationAbsolute()

virtual void nkGraphics::Camera::setOrientationAbsolute | ( | const nkMaths::Quaternion & | value | ) |
| override virtual

See Node::setOrientationAbsolute().

Reimplemented from nkGraphics::Node.

## ◆ rotateRelative()

virtual void nkGraphics::Camera::rotateRelative | ( | const nkMaths::Quaternion & | value | ) |
| override virtual

See Node::rotateRelative().

Reimplemented from nkGraphics::Node.

## ◆ rotateAbsolute()

virtual void nkGraphics::Camera::rotateAbsolute | ( | const nkMaths::Quaternion & | value | ) |
| override virtual

See Node::rotateAbsolute().

Reimplemented from nkGraphics::Node.

## ◆ setScaleRelative()

virtual void nkGraphics::Camera::setScaleRelative | ( | const nkMaths::Vector & | value | ) |
| override virtual

See Node::setScaleRelative().

Reimplemented from nkGraphics::Node.

## ◆ setScaleAbsolute()

virtual void nkGraphics::Camera::setScaleAbsolute | ( | const nkMaths::Vector & | value | ) |
| override virtual

See Node::setScaleAbsolute().

Reimplemented from nkGraphics::Node.

## ◆ applyScale()

virtual void nkGraphics::Camera::applyScale | ( | const nkMaths::Vector & | value | ) |
| override virtual

See Node::applyScale().

Reimplemented from nkGraphics::Node.

## ◆ setName()

void nkGraphics::Camera::setName | ( | nkMemory::StringView | name | ) |

Sets the name of the camera.

Parameters

  name | The name to assign.

Remarks
  In theory, should never be called by external code.

## ◆ setAsPerspective()

void nkGraphics::Camera::setAsPerspective | ( | float | fovRadian,
|  | float | aspectRatioWidthOverHeight
| ) |  |

Sets the camera up for perspective projection.

Parameters

  fovRadian | The vertical field of view, in radian.
  aspectRatioWidthOverHeight | The aspect ratio, given as width / height.

Remarks
  If one of the perspective parameter needs to be changed, this method needs to be called again. It is useful in such case to use the getters for associated parameters that should remain the same.

## ◆ setAsPerspectiveReverseZ()

void nkGraphics::Camera::setAsPerspectiveReverseZ | ( | float | fovRadian,
|  | float | aspectRatioWidthOverHeight
| ) |  |

Sets the camera up for perspective projection, with a reverse Z logic (near = 1, far = 0). This redistributes the Z buffer precision, allowing to use a far bigger range for the camera.
The rendering needs to be accomodated to support this, by :

- Cleaning the depth buffer to 0 instead of 1.
- Using the COMPARISON_FUNCTION::FUNCTION_GREATER depth comparison function (DepthStencilState::setDepthComparison()).
- Use floating point depth targets, preferrably 32bits (FORMAT::D32_FLOAT).

Parameters

  fovRadian | The vertical field of view, in radian.
  aspectRatioWidthOverHeight | The aspect ratio, given as width / height.

Remarks
  If one of the perspective parameter needs to be changed, this method needs to be called again. It is useful in such case to use the getters for associated parameters that should remain the same.

## ◆ setAsPerspectiveReverseInfiniteZ()

void nkGraphics::Camera::setAsPerspectiveReverseInfiniteZ | ( | float | fovRadian,
|  | float | aspectRatioWidthOverHeight
| ) |  |

Sets the camera up for perspective projection, with a reverse Z logic (near = 1, far = 0). All the details from setAsPerspectiveReverseZ() apply, this time considering far as being infinite.
This means the far value within the set range won't be used. While the infinite Z can be used in most cases once the rendering is adapted to the reverse Z values, it might still be attractive to use a finite Z value :

- To maintain a finite frustum, maintaining far culling capabilities.
- To be able to compress Z precision in a known interval, for instance for shadow maps.
- To continue being able to use formulas that rely on a finite far.

Parameters

  fovRadian | The vertical field of view, in radian.
  aspectRatioWidthOverHeight | The aspect ratio, given as width / height.

Remarks
  If one of the perspective parameter needs to be changed, this method needs to be called again. It is useful in such case to use the getters for associated parameters that should remain the same.

## ◆ setAsPerspectiveOffCenter()

void nkGraphics::Camera::setAsPerspectiveOffCenter | ( | float | fovLeftRadian,
|  | float | fovRightRadian,
|  | float | fovTopRadian,
|  | float | fovBottomRadian
| ) |  |

Sets the camera up for off-center perspective projection.

Parameters

  fovLeftRadian | The horizontal left field of view angle from the theoretical projection center, in radians.
  fovRightRadian | The horizontal right field of view angle from the theoretical projection center, in radians.
  fovTopRadian | The vertical top field of view angle from the theoretical projection center, in radians.
  fovBottomRadian | The vertical bottom field of view angle from the theoretical projection center, in radians.

Remarks
  If one of the perspective parameter needs to be changed, this method needs to be called again. It is useful in such case to use the getters for associated parameters that should remain the same.

## ◆ setAsPerspectiveOffCenterReverseZ()

void nkGraphics::Camera::setAsPerspectiveOffCenterReverseZ | ( | float | fovLeftRadian,
|  | float | fovRightRadian,
|  | float | fovTopRadian,
|  | float | fovBottomRadian
| ) |  |

Sets the camera up for off-center perspective projection, with a reverse Z logic (near = 1, far = 0). Please check setAsPerspectiveReverseZ() to understand the benefits of doing so.

Parameters

  fovLeftRadian | The horizontal left field of view angle from the theoretical projection center, in radians.
  fovRightRadian | The horizontal right field of view angle from the theoretical projection center, in radians.
  fovTopRadian | The vertical top field of view angle from the theoretical projection center, in radians.
  fovBottomRadian | The vertical bottom field of view angle from the theoretical projection center, in radians.

Remarks
  If one of the perspective parameter needs to be changed, this method needs to be called again. It is useful in such case to use the getters for associated parameters that should remain the same.

## ◆ setAsPerspectiveOffCenterReverseInfiniteZ()

void nkGraphics::Camera::setAsPerspectiveOffCenterReverseInfiniteZ | ( | float | fovLeftRadian,
|  | float | fovRightRadian,
|  | float | fovTopRadian,
|  | float | fovBottomRadian
| ) |  |

Sets the camera up for off-center perspective projection, with a reverse and infinite Z logic (near = 1, far = 0). Please check setAsPerspectiveReverseInfiniteZ() to understand the benefits of doing so.

Parameters

  fovLeftRadian | The horizontal left field of view angle from the theoretical projection center, in radians.
  fovRightRadian | The horizontal right field of view angle from the theoretical projection center, in radians.
  fovTopRadian | The vertical top field of view angle from the theoretical projection center, in radians.
  fovBottomRadian | The vertical bottom field of view angle from the theoretical projection center, in radians.

Remarks
  If one of the perspective parameter needs to be changed, this method needs to be called again. It is useful in such case to use the getters for associated parameters that should remain the same.

## ◆ setAsOrthographic()

void nkGraphics::Camera::setAsOrthographic | ( | float | height,
|  | float | aspectRatioWidthOverHeight
| ) |  |

Sets the camera up for orthographic projection.

Parameters

  height | The projection's height, in world units.
  aspectRatioWidthOverHeight | The aspect ratio, given as width / height.

Remarks
  If one of the perspective parameter needs to be changed, this method needs to be called again. It is useful in such case to use the getters for associated parameters that should remain the same.

## ◆ setAsOrthographicReverseZ()

void nkGraphics::Camera::setAsOrthographicReverseZ | ( | float | height,
|  | float | aspectRatioWidthOverHeight
| ) |  |

Sets the camera up for orthographic projection, with a reverse Z logic (near = 1, far = 0). While the orthographic projection depth is linear and does not benefit from a reversed Z, this method can allow to match an orthographic projection with a rendering pipeline set for reverse Z projections.

Parameters

  height | The projection's height, in world units.
  aspectRatioWidthOverHeight | The aspect ratio, given as width / height.

Remarks
  If one of the perspective parameter needs to be changed, this method needs to be called again. It is useful in such case to use the getters for associated parameters that should remain the same.

## ◆ setRange()

void nkGraphics::Camera::setRange | ( | float | near,
|  | float | far
| ) |  |

Sets the projection's distance range interval.

Parameters

  near | The near plane distance in world units.
  far | The far plane distance in world units.

## ◆ prepareForContext()

void nkGraphics::Camera::prepareForContext | ( | RenderContext * | context | ) |

Prepare the camera to be used by a render context. Will update values like the aspect ratio to be compatible with the rendering surface associated.

Parameters

  context | The context to adapt to.

## ◆ setAutoUpdateOnContextSwitch()

void nkGraphics::Camera::setAutoUpdateOnContextSwitch | ( | bool | value | ) |

Sets whether the camera should be updated for the context given before rendering. For instance, this will update the aspect ratio to fit the dimension of the render target.

Parameters

  value | Whether the camera should be updated (true) or not (false) when a context switch is done.

Remarks
  This can be useful when using a camera to render a scene on different windows / textures, for instance. In case rendering has to take specific aspect ratio for any purpose, this flag can remain off.

## ◆ setHidden()

void nkGraphics::Camera::setHidden | ( | bool | value | ) |

Sets whether the camera is hidden from project exporting. If enabled, the camera won't be exported in the decl files of the project. This can be useful when a camera is created programmatically in an application, and should not be duplicated in the declaration files.

Parameters

  value | If the camera should be hidden (true) or not (false).

## ◆ updateViewMatrix()

void nkGraphics::Camera::updateViewMatrix | ( |  | ) |

Updates the view matrix after new changes in parameters occurred.

## ◆ updateProjectionMatrix()

void nkGraphics::Camera::updateProjectionMatrix | ( |  | ) |

Updates the projection matrix after new changes in parameters occurred.

## ◆ lookAt()

void nkGraphics::Camera::lookAt | ( | const nkMaths::Vector & | point,
|  | const nkMaths::Vector & | enforcedUp = `nkMaths::Vector(0, 0, 0, 0)`
| ) |  |

Sets the camera to look at a coordinate.

Parameters

  point | The point to look at.
  enforcedUp | The up direction to take. If left blank, an automatic up is computed.

## ◆ getNearPlanePoints()

void nkGraphics::Camera::getNearPlanePoints | ( | nkMaths::Vector & | a,
|  | nkMaths::Vector & | b,
|  | nkMaths::Vector & | c,
|  | nkMaths::Vector & | d
| ) |  |

Fills up the 4 points of the near plane.

Parameters

  a | The first point.
  b | The second point.
  c | The third point.
  d | The fourth point.

## ◆ getFarPlanePoints()

void nkGraphics::Camera::getFarPlanePoints | ( | nkMaths::Vector & | a,
|  | nkMaths::Vector & | b,
|  | nkMaths::Vector & | c,
|  | nkMaths::Vector & | d
| ) |  |

Fills up the 4 points of the far plane.

Parameters

  a | The first point.
  b | The second point.
  c | The third point.
  d | The fourth point.

## ◆ getFrustumCornersDirectionsWorld()

void nkGraphics::Camera::getFrustumCornersDirectionsWorld | ( | nkMaths::Vector & | a,
|  | nkMaths::Vector & | b,
|  | nkMaths::Vector & | c,
|  | nkMaths::Vector & | d
| ) |  |

Fills up the directions of the frustum corners, in world space. Can be seen as the directions from the near plane points, to their attached far plane points.

Parameters

  a | The first direction.
  b | The second direction.
  c | The third direction.
  d | The fourth direction.

## ◆ getFrustumCornersDirectionsView()

void nkGraphics::Camera::getFrustumCornersDirectionsView | ( | nkMaths::Vector & | a,
|  | nkMaths::Vector & | b,
|  | nkMaths::Vector & | c,
|  | nkMaths::Vector & | d
| ) |  |

Fills up the directions of the frustum corners, in view space. Can be seen as the directions from the near plane points, to their attached far plane points.

Parameters

  a | The first direction.
  b | The second direction.
  c | The third direction.
  d | The fourth direction.

## ◆ getDirectionAtPixelWorld()

nkMaths::Vector nkGraphics::Camera::getDirectionAtPixelWorld | ( | int | x,
|  | int | y,
|  | RenderContext * | fromContext = `nullptr`
| ) |  |

Returns the direction, in world space, for one pixel.

Parameters

  x | The x coordinate of the pixel.
  y | The y coordinate of the pixel.
  fromContext | The context from which the pixel size should be retrieved. If left nullptr, the active context will be queried.

Returns
  The direction of the pixel, in world space.

Remarks
  If a context is given, it will be used to deduce the relative coordinates to sample from. Note that no change in ratio or projection matrix will take place for the given context.

## ◆ getDirectionAtScreenCoordWorld()

nkMaths::Vector nkGraphics::Camera::getDirectionAtScreenCoordWorld | ( | float | x,
|  | float | y
| ) |  |

Returns the direction, in world space, for a given position on screen.

Parameters

  x | The x coordinate, in [0, 1].
  y | The y coordinate, in [0, 1].

Returns
  The direction on screen, in world space.

## ◆ getDirectionAtPixelView()

nkMaths::Vector nkGraphics::Camera::getDirectionAtPixelView | ( | int | x,
|  | int | y,
|  | RenderContext * | fromContext = `nullptr`
| ) |  |

Returns the direction, in view space, for one pixel.

Parameters

  x | The x coordinate of the pixel.
  y | The y coordinate of the pixel.
  fromContext | The context from which the pixel size should be retrieved. If left nullptr, the active context will be queried.

Returns
  The direction of the pixel, in view space.

Remarks
  If a context is given, it will be used to deduce the relative coordinates to sample from. Note that no change in ratio or projection matrix will take place for the given context.

## ◆ getDirectionAtScreenCoordView()

nkMaths::Vector nkGraphics::Camera::getDirectionAtScreenCoordView | ( | float | x,
|  | float | y
| ) |  |

Returns the direction, in view space, for a given position on screen. , in [

Parameters

  x | The x coordinate0, 1].
  y | The y coordinate, in [0, 1].

Returns
  The direction on screen, in view space.

## ◆ exportClassToTree()

virtual void nkGraphics::Camera::exportClassToTree | ( | nkExport::Node * | rootNode | ) |
| override virtual

Exports an item into a tree describing its structure and its data.

Parameters

  rootNode | The node into which the object has to write its related information.

Reimplemented from nkGraphics::Node.

## ◆ importClassFromTree()

virtual void nkGraphics::Camera::importClassFromTree | ( | nkExport::Node * | rootNode | ) |
| override virtual

Imports information from a tree which is supposed to describe its structure and data.

Parameters

  rootNode | The root node of the tree holding the information.

Reimplemented from nkGraphics::Node.

## ◆ create()

static nkMemory::UniquePtr<Camera> nkGraphics::Camera::create | ( | System * | system = `nullptr` | ) |
| static

Creates a standalone resource, linking it to a system, but no manager. This method can be used to allocate a resource and manually manage its lifetime.

Parameters

  system | The system to create the resource into. If left to nullptr, then the Singleton instance will be used.

Returns
  The created resource instance.

The documentation for this class was generated from the following file:

- Documentation/Headers/NilkinsGraphics/Cameras/Camera.h